Skip to content

fix(build): commit ui/dist/ so go install ships a working web UI#96

Closed
aksOps wants to merge 1 commit intomainfrom
fix/embed-ui-dist
Closed

fix(build): commit ui/dist/ so go install ships a working web UI#96
aksOps wants to merge 1 commit intomainfrom
fix/embed-ui-dist

Conversation

@aksOps
Copy link
Copy Markdown
Contributor

@aksOps aksOps commented May 4, 2026

Summary

Without committed ui/dist/ assets, go install github.com/RandomCodeSpace/docsiq@vX.Y.Z produces a binary that serves the placeholder index.html and 404s on every /assets/* request — because Go's //go:embed ui/dist directive can only embed files actually present in the source tree (which is what proxy.golang.org mirrors).

This PR commits the built dist and updates the gitignore + workflow.

Changes

  • .gitignore — replaces the ui/dist/* re-ignore with !ui/dist/**. Comment updated to explain why dist is now committed and to call out the npm run build + git add ui/dist/ step that must happen before tagging.
  • ui/dist/{assets,fonts,...} — fresh npm run build output committed. ~27 files, 1.2 MB total.

Verified

  • make build clean.
  • A fresh go build -tags sqlite_fts5 -o ./docsiq . against this branch produces a binary that, on serve, returns HTTP 200 for every /assets/<hash>.js and /assets/<hash>.css referenced by ui/dist/index.html.

Trade-off documented

Every UI source change now requires running npm run build and committing the regenerated ui/dist/ alongside the source diff (asset hashes change with content). This is the price of keeping go install working as a first-class install path.

Test plan

  • CI green on ci, codeql, playwright, security
  • After merge + tag, go install github.com/RandomCodeSpace/docsiq@v0.1.5 (or whatever the next tag is) followed by docsiq serve produces a UI where every asset loads

The Go //go:embed ui/dist directive needs the real built SPA assets
present at compile time. Until now the gitignore excluded ui/dist/*
except for a placeholder index.html, which meant
`go install github.com/RandomCodeSpace/docsiq@vX.Y.Z` produced a
binary that served the placeholder + 404'd on every /assets/* request.
Release binaries on GitHub were unaffected (CI runs `npm run build`
before `go build`), but `go install` users got a broken UI.

Fix:
- .gitignore: drop the `ui/dist/*` exception so dist contents are
  committed; comment now documents the workflow (`npm run build` and
  commit before tagging).
- Commit the current `npm run build` output (assets/, fonts/,
  manifest.webmanifest, sw.js, icons, refreshed index.html). 1.2 MB
  total; ~27 files.

Verified: a fresh `go build` against this tree produces a binary that
returns HTTP 200 for every /assets/<hashed>.js and /assets/<hashed>.css
path the index.html references.

Workflow note: future UI source changes must be paired with
`npm run build` + `git add ui/dist/` before tagging a release. CI also
re-runs `npm run build` so the release binaries always reflect the
latest UI tree, but the committed dist is what `go install` users
receive.
@aksOps aksOps enabled auto-merge (squash) May 4, 2026 04:34
@aksOps
Copy link
Copy Markdown
Contributor Author

aksOps commented May 4, 2026

Closing in favour of a release-time approach: the release workflow will commit ui/dist/ to the tagged commit only, leaving main clean. New PR will modify .github/workflows/release.yml. Detail below.

@aksOps aksOps closed this May 4, 2026
auto-merge was automatically disabled May 4, 2026 04:35

Pull request was closed

@aksOps aksOps deleted the fix/embed-ui-dist branch May 4, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant